package com.situ.day1;

//实体类  和数据库中表一一对应
public class Student extends Object{
    private Integer id;//null
    private String name;
    private Integer age;
    private Double salary;

    //无参构造方法
    public Student() {

    }

    //有参构造方法
    public Student(Integer id, String name, Integer age, Double salary) {
        this.id = id;
        this.name = name;
        this.age = age;
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    //实例方法
    public void setName(String name) {
        //就近原则
        //name = name;
        //this当前类的对象
        this.name = name;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Double getSalary() {
        return salary;
    }

    public void setSalary(Double salary) {
        this.salary = salary;
    }

    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", age=" + age +
                ", salary=" + salary +
                '}';
    }
}
